﻿
$(function () {
    if ($("#Login_path").text() == "") {
        $("#Browsing_path").val("C:\\Users\\Public\\Documents")
    }
})
$(document).on("click", "#HOME_Settings", function () {
    $("#Setup_panel").css({ "display": "block" });
})
$(document).on("click", "#Setup_panel_quit", function () {
    $("#Setup_panel").css({ "display": "none" });
})
$(document).on("click", "#Path_change", function () {
    $.ajax({
        url: '/Material/SelectFilePath',
        type: 'POST',
        data: { "shu": 1 },
        success: function (path) {
            $("#Browsing_path").val(path)
        },
        error: function () {
            alert("系统错误!");
        }
    })
})

$(document).on("click", "#Setup_panel_OK", function () {
    var fileUpload = $('#file1')[0];
    if (fileUpload.files.length > 0) {
        var fileData = new FormData();
        fileData.append('file', fileUpload.files[0]);
            $.ajax({
                url: '/Contracts/AddNdardo',
                type: 'POST',
                contentType: false, // 不设置内容类型  
                processData: false, // 不处理数据  
                data: fileData,
                success: function (response) {
                    var sjinf = $("#Login_name").val()
                    var dal = {
                        "DE_ID": sjinf,
                        "DE_dizhi": response
                    }
                    $.ajax({
                        url: '/Material/Modify_Download_path',
                        type: 'POST',
                        data: { "dl": dal },
                        success: function (response) {
                           
                        },
                        error: function (jqXHR, textStatus, errorMessage) {
                            alert('AJAX请求失败：' + errorMessage);
                        }
                    });
                },
                error: function (jqXHR, textStatus, errorMessage) {
                    alert('AJAX请求失败：' + errorMessage);
                }
            });


        }
})
$(document).on("click", "#Submitss", function () {
    var oldpwd = $("#oldpwd").val()
    var newpwd = $("#newpwd").val()
    var newpwd2 = $("#newpwd2").val()
    $.ajax({
        url: "/Material/ChagnPwd",
        type: "POST",
        data: { "oldpwd": oldpwd, "newpwd": newpwd, "newpwd2": newpwd2 },
        success: function (path) {
            $("#newpwd2_l").text(path)
            window.location = true;
        },
        error: function (path) {
            alert("系统错误!");
        }
    })
})
$(document).ready(function () {
    $("#ulij>li>h6").click(function () {
        $(this).next("ul").toggle()
    }/*,function () {
        $(thiss).children("ul").stop(true).slideUp(500)
    }*/)

})
//$(document).ready(function () {
//    setInterval(function () {
//        var now = moment();
//        var dateTimeFormat = 'YYYY-MM-DD HH:mm:ss'; // 设置日期和时间的格式
//        $('#date-time').text(now.format(dateTimeFormat)); // 更新div元素的内容
//    }, 1000); // 每秒更新一次
//});
function sjin() {
    var newpwd2 = $("#LoUid").val()
    $.ajax({
        url: "/Material/ChagnPwd",
        type: "POST",
        data: {  },
        success: function (path) {
            $("#newpwd2_l").text(path)
            window.location = true;
        },
        error: function (path) {
            alert("系统错误!");
        }
    })
}